<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<script type="text/javascript" src="lib/PIE_IE678.js"></script>
<![endif]-->
<link href="css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="lib/icheck/icheck.css" rel="stylesheet" type="text/css" />
<link href="lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet" type="text/css" />
<link href="lib/webuploader/0.1.5/webuploader.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title>新增T_member</title>
</head>
<body>
<div class="pd-20">
	<form action="<%=path%>/backstage/t_member_shipper-add" method="post" class="form form-horizontal" id="form-t_member-add">
		<input type="hidden" id="id" name="id" value='${t_member.c_id}' />
        
        <div class="row cl">
			<label class="form-label col-2">手机号：</label>
            <div class="formControls col-2">
                <input type="text" class="input-text" value="${t_member.c_mob}" placeholder="" id="c_mob" name="c_mob" datatype="m" nullmsg="不能为空" style="width: 300px;"><span id="span_mod" class="c-red"></span>
        	</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">密码：</label>
			<div class="formControls col-2">
				<input type="text" name="c_pass" type="password" datatype="*" nullmsg="请填写" id="" placeholder="" value="${t_member.c_pass}" class="input-text" style="width: 300px;">
			</div>
		</div>
        <div class="row cl">
			<label class="form-label col-2">所属分站：</label>
			<div class="formControls col-2">
				<span class="select-box">
					<select name="c_city" class="select" datatype="n" nullmsg="请选择县市">
						<c:forEach items="${citys}" var="city">
						<option value="${city.id}" <c:if test="${city.id==t_member.c_city}">selected</c:if> >${city.name}</option>
						</c:forEach>
					</select>
				</span>
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-2">真实姓名：</label>
            <div class="formControls col-2">
                <input type="text" class="input-text" value="${t_member.c_tname}" placeholder="" id="" name="c_tname" datatype="*" nullmsg="不能为空" style="width: 300px;">
        	</div>
		</div>
        <div class="row cl">

			<label class="form-label col-2">通讯地址：</label>
            <div class="formControls col-8">
                <input type="text" class="input-text" value="${t_member.c_address}" placeholder="" id="" name="c_address" datatype="*" nullmsg="不能为空">
        	</div>
		</div>

        <div class="row cl">
			<label class="form-label col-2">账号余额：</label>
            <div class="formControls col-2">  
                <input type="text" class="input-text" value="${empty shipper_account.money ? 0 : shipper_account.money }"   readonly="readonly" placeholder="" id="" name="c_money" datatype="*" nullmsg="不能为空">
        	</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-2">备用金：</label>
            <div class="formControls col-2">
                <input type="text" class="input-text" value="${t_member.reserve_money}" placeholder="" id="" name="reserve_money" datatype="*" nullmsg="不能为空">
        	</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-2">基本工资：</label>
            <div class="formControls col-2">
                <input type="text" class="input-text" value="${t_member.basic_wage}" placeholder="" id="" name="basic_wage" datatype="*" nullmsg="不能为空">
        	</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-2">提现银行：</label>
            <div class="formControls col-2">
                <input type="text" class="input-text" value="${t_member.bank_card}" placeholder="" id="" name="bank_card" datatype="*" nullmsg="不能为空" style="width: 300px;">
        	</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-2">银行卡号：</label>
            <div class="formControls col-2">
                <input type="text" class="input-text" value="${t_member.bank_num}" placeholder="" id="" name="bank_num" datatype="n" nullmsg="不能为空" style="width: 300px;">
        	</div>
		</div>
		
		<div class="row cl">
			<label class="form-label col-2">身份证号：</label>
            <div class="formControls col-2">
                <input type="text" class="input-text" value="${t_member.ID_num}" placeholder="" id="" name="ID_num" datatype="n" nullmsg="不能为空" style="width: 300px;">
        	</div>
		</div>
        
        <div class="row cl">
			<c:if test="${t_member.ID_card!=null&&t_member.ID_card!=''}">
			<label class="form-label col-2"></label>
			<div class="formControls col-10"><img src="<%=imagePath%>${t_member.ID_card}" width="100" border="0" /></div>
			</c:if>
		</div>
		<div class="row cl">
			<label class="form-label col-2">身份证：</label>
			<div class="formControls col-10">
				<div class="uploader-thum-container">
					<div id="fileList" class="uploader-list"></div>
					<div id="filePicker">选择图片</div>
					<button id="btn-star" type="button"  class="btn btn-default btn-uploadstar radius ml-10">开始上传</button>
				</div>
			</div>
		</div>
		<input type="hidden" id="ID_card" name="ID_card" value="${t_member.ID_card}" datatype="*" nullmsg="不能为空"/>
		<div class="row cl">
			<c:if test="${t_member.health_card!=null&&t_member.health_card!=''}">
			<label class="form-label col-2"></label>
			<div class="formControls col-10"><img src="<%=imagePath%>${t_member.health_card}" width="100" border="0" /></div> 
			</c:if>
		</div>
		<div class="row cl">
			<label class="form-label col-2">健康证：</label>
			<div class="formControls col-10">
				<div class="uploader-thum-container">
					<div id="fileList2" class="uploader-list"></div>
					<div id="filePicker2">选择图片</div>
					<button id="btn-star2" type="button"  class="btn btn-default btn-uploadstar radius ml-10">开始上传</button>
				</div>
			</div>
		</div>
		<input type="hidden" id="health_card" name="health_card" value="${t_member.health_card}" />
        
        <div class="row cl">
			<c:if test="${t_member.c_pname!=null&&t_member.c_pname!=''}">
			<label class="form-label col-2"></label>
			<div class="formControls col-10"><img src="<%=imagePath%>${t_member.c_pname}" width="100" border="0" /></div>
			</c:if>
		</div>
		<div class="row cl">
			<label class="form-label col-2">头像：</label>
			<div class="formControls col-10">
				<div class="uploader-thum-container">
					<div id="fileList3" class="uploader-list"></div>
					<div id="filePicker3">选择图片</div>
					<button id="btn-star3" type="button"  class="btn btn-default btn-uploadstar radius ml-10">开始上传</button>
				</div>
			</div>
		</div>
		<input type="hidden" id="c_pname" name="c_pname" value="${t_member.c_pname}" datatype="*" nullmsg="不能为空"/>
        
		<div class="row cl">
			<div class="col-10 col-offset-2">
				<button onClick="t_member_save_submit();" class="btn btn-primary radius" type="submit"><i class="Hui-iconfont">&#xe632;</i> 保存并提交</button>
				<button onClick="layer_close();" class="btn btn-default radius" type="button">&nbsp;&nbsp;取消&nbsp;&nbsp;</button>
			</div>
		</div>
	</form>
</div>
</div>
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="lib/layer/2.1/layer.js"></script> 
<script type="text/javascript" src="lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="lib/icheck/jquery.icheck.min.js"></script> 
<script type="text/javascript" src="lib/Validform/5.3.2/Validform.min.js"></script> 
<script type="text/javascript" src="lib/webuploader/0.1.5/webuploader.min.js"></script> 
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.config.js"></script>
<script type="text/javascript" src="lib/ueditor/1.4.3/ueditor.all.min.js"> </script>
<script type="text/javascript" src="lib/ueditor/1.4.3/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript" src="js/H-ui.js"></script> 
<script type="text/javascript" src="js/H-ui.admin.js"></script> 
<script type="text/javascript">
var istrue=1;

$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	// 优化retina, 在retina下这个值是2
	ratio = window.devicePixelRatio || 1,
	// 缩略图大小
	thumbnailWidth = 110 * ratio,
	thumbnailHeight = 110 * ratio,

	$list = $("#fileList"),
	$btn = $("#btn-star"),
	state = "pending",
	uploader;

	var uploader = WebUploader.create({
		auto: true,
		swf: 'lib/webuploader/0.1.5/Uploader.swf',
	
		// 文件接收服务端。
		server: '<%=path%>/backstage/type-logo-upload',
	
		// 选择文件的按钮。可选。
		// 内部根据当前运行是创建，可能是input元素，也可能是flash.
		pick: '#filePicker',
	
		// 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
		resize: false,
		// 只允许选择图片文件。
		accept: {
			title: 'Images',
			extensions: 'gif,jpg,jpeg,bmp,png',
			mimeTypes: 'image/*'
		}
	});
	uploader.on( 'fileQueued', function( file ) {
		var $li = $(
			'<div id="' + file.id + '" class="item">' +
				'<div class="pic-box"><img></div>'+
				'<div class="info">' + file.name + '</div>' +
				'<p class="state">等待上传...</p>'+
			'</div>'
		),
		$img = $li.find('img');
		$list.append( $li );
	
		// 创建缩略图
		// 如果为非图片文件，可以不用调用此方法。
		// thumbnailWidth x thumbnailHeight 为 100 x 100
		uploader.makeThumb( file, function( error, src ) {
			if ( error ) {
				$img.replaceWith('<span>不能预览</span>');
				return;
			}
	
			$img.attr( 'src', src );
		}, thumbnailWidth, thumbnailHeight );
	});
	// 文件上传过程中创建进度条实时显示。
	uploader.on( 'uploadProgress', function( file, percentage ) {
		var $li = $( '#'+file.id ),
			$percent = $li.find('.progress-box .sr-only');
	
		// 避免重复创建
		if ( !$percent.length ) {
			$percent = $('<div class="progress-box"><span class="progress-bar radius"><span class="sr-only" style="width:0%"></span></span></div>').appendTo( $li ).find('.sr-only');
		}
		$li.find(".state").text("上传中");
		$percent.css( 'width', percentage * 100 + '%' );
	});
	
	// 文件上传成功，给item添加成功class, 用样式标记上传成功。
	uploader.on( 'uploadSuccess', function( file, response ) {
		$( '#'+file.id ).addClass('upload-state-success').find(".state").text("已上传");
		$("#ID_card").val(response.datas);
	});
	
	// 文件上传失败，显示上传出错。
	uploader.on( 'uploadError', function( file ) {
		$( '#'+file.id ).addClass('upload-state-error').find(".state").text("上传出错");
	});
	
	// 完成上传完了，成功或者失败，先删除进度条。
	uploader.on( 'uploadComplete', function( file ) {
		$( '#'+file.id ).find('.progress-box').fadeOut();
	});
	uploader.on('all', function (type) {
        if (type === 'startUpload') {
            state = 'uploading';
        } else if (type === 'stopUpload') {
            state = 'paused';
        } else if (type === 'uploadFinished') {
            state = 'done';
        }

        if (state === 'uploading') {
            $btn.text('暂停上传');
        } else {
            $btn.text('开始上传');
        }
    });

    $btn.on('click', function () {
        if (state === 'uploading') {
            uploader.stop();
        } else {
            uploader.upload();
        }
    });

});


$(function(){

	$list2 = $("#fileList2"),
	$btn2 = $("#btn-star2"),
	state = "pending",
	uploader2;

	var uploader2 = WebUploader.create({
		auto: true,
		swf: 'lib/webuploader/0.1.5/Uploader.swf',
	
		// 文件接收服务端。
		server: '<%=path%>/backstage/type-logo-upload',
	
		// 选择文件的按钮。可选。
		// 内部根据当前运行是创建，可能是input元素，也可能是flash.
		pick: '#filePicker2',
	
		// 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
		resize: false,
		// 只允许选择图片文件。
		accept: {
			title: 'Images',
			extensions: 'gif,jpg,jpeg,bmp,png',
			mimeTypes: 'image/*'
		}
	});
	uploader2.on( 'fileQueued', function( file ) {
		var $li = $(
			'<div id="' + file.id + '" class="item">' +
				'<div class="pic-box"><img></div>'+
				'<div class="info">' + file.name + '</div>' +
				'<p class="state">等待上传...</p>'+
			'</div>'
		),
		$img = $li.find('img');
		$list2.append( $li );
	
		// 创建缩略图
		// 如果为非图片文件，可以不用调用此方法。
		// thumbnailWidth x thumbnailHeight 为 100 x 100
		uploader2.makeThumb( file, function( error, src ) {
			if ( error ) {
				$img.replaceWith('<span>不能预览</span>');
				return;
			}
	
			$img.attr( 'src', src );
		}, thumbnailWidth, thumbnailHeight );
	});
	// 文件上传过程中创建进度条实时显示。
	uploader2.on( 'uploadProgress', function( file, percentage ) {
		var $li = $( '#'+file.id ),
			$percent = $li.find('.progress-box .sr-only');
	
		// 避免重复创建
		if ( !$percent.length ) {
			$percent = $('<div class="progress-box"><span class="progress-bar radius"><span class="sr-only" style="width:0%"></span></span></div>').appendTo( $li ).find('.sr-only');
		}
		$li.find(".state").text("上传中");
		$percent.css( 'width', percentage * 100 + '%' );
	});
	
	// 文件上传成功，给item添加成功class, 用样式标记上传成功。
	uploader2.on( 'uploadSuccess', function( file, response ) {
		$( '#'+file.id ).addClass('upload-state-success').find(".state").text("已上传");
		$("#health_card").val(response.datas);
	});
	
	// 文件上传失败，显示上传出错。
	uploader2.on( 'uploadError', function( file ) {
		$( '#'+file.id ).addClass('upload-state-error').find(".state").text("上传出错");
	});
	
	// 完成上传完了，成功或者失败，先删除进度条。
	uploader2.on( 'uploadComplete', function( file ) {
		$( '#'+file.id ).find('.progress-box').fadeOut();
	});
	uploader2.on('all', function (type) {
        if (type === 'startUpload') {
            state = 'uploading';
        } else if (type === 'stopUpload') {
            state = 'paused';
        } else if (type === 'uploadFinished') {
            state = 'done';
        }

        if (state === 'uploading') {
            $btn2.text('暂停上传');
        } else {
            $btn2.text('开始上传');
        }
    });

    $btn2.on('click', function () {
        if (state === 'uploading') {
            uploader2.stop();
        } else {
            uploader2.upload();
        }
    });

});

$(function(){

	$list3 = $("#fileList3"),
	$btn3 = $("#btn-star3"),
	state = "pending",
	uploader3;

	var uploader3 = WebUploader.create({
		auto: true,
		swf: 'lib/webuploader/0.1.5/Uploader.swf',
	
		// 文件接收服务端。
		server: '<%=path%>/backstage/type-logo-upload',
	
		// 选择文件的按钮。可选。
		// 内部根据当前运行是创建，可能是input元素，也可能是flash.
		pick: '#filePicker3',
	
		// 不压缩image, 默认如果是jpeg，文件上传前会压缩一把再上传！
		resize: false,
		// 只允许选择图片文件。
		accept: {
			title: 'Images',
			extensions: 'gif,jpg,jpeg,bmp,png',
			mimeTypes: 'image/*'
		}
	});
	uploader3.on( 'fileQueued', function( file ) {
		var $li = $(
			'<div id="' + file.id + '" class="item">' +
				'<div class="pic-box"><img></div>'+
				'<div class="info">' + file.name + '</div>' +
				'<p class="state">等待上传...</p>'+
			'</div>'
		),
		$img = $li.find('img');
		$list3.append( $li );
	
		// 创建缩略图
		// 如果为非图片文件，可以不用调用此方法。
		// thumbnailWidth x thumbnailHeight 为 100 x 100
		uploader3.makeThumb( file, function( error, src ) {
			if ( error ) {
				$img.replaceWith('<span>不能预览</span>');
				return;
			}
	
			$img.attr( 'src', src );
		}, thumbnailWidth, thumbnailHeight );
	});
	// 文件上传过程中创建进度条实时显示。
	uploader3.on( 'uploadProgress', function( file, percentage ) {
		var $li = $( '#'+file.id ),
			$percent = $li.find('.progress-box .sr-only');
	
		// 避免重复创建
		if ( !$percent.length ) {
			$percent = $('<div class="progress-box"><span class="progress-bar radius"><span class="sr-only" style="width:0%"></span></span></div>').appendTo( $li ).find('.sr-only');
		}
		$li.find(".state").text("上传中");
		$percent.css( 'width', percentage * 100 + '%' );
	});
	
	// 文件上传成功，给item添加成功class, 用样式标记上传成功。
	uploader3.on( 'uploadSuccess', function( file, response ) {
		$( '#'+file.id ).addClass('upload-state-success').find(".state").text("已上传");
		$("#c_pname").val(response.datas);
	});
	
	// 文件上传失败，显示上传出错。
	uploader3.on( 'uploadError', function( file ) {
		$( '#'+file.id ).addClass('upload-state-error').find(".state").text("上传出错");
	});
	
	// 完成上传完了，成功或者失败，先删除进度条。
	uploader3.on( 'uploadComplete', function( file ) {
		$( '#'+file.id ).find('.progress-box').fadeOut();
	});
	uploader3.on('all', function (type) {
        if (type === 'startUpload') {
            state = 'uploading';
        } else if (type === 'stopUpload') {
            state = 'paused';
        } else if (type === 'uploadFinished') {
            state = 'done';
        }

        if (state === 'uploading') {
            $btn3.text('暂停上传');
        } else {
            $btn3.text('开始上传');
        }
    });

    $btn3.on('click', function () {
        if (state === 'uploading') {
            uploader3.stop();
        } else {
            uploader3.upload();
        }
    });

});

function t_member_save_submit(){
	$("#form-t_member-add").Validform({
		tiptype:2,
		ajaxPost:true,
		beforeSubmit:function(form){
			if (istrue==0)
			return false;
		},
		callback:function(form){
			var index = parent.layer.getFrameIndex(window.name);
			if (index){//关闭弹出层
				parent.$('.btn-refresh').click(); 
				parent.layer.close(index);
			}else{//单独的页面
				location.href = "<%=path%>/backstage/t_member_shipper_list"; 
			}
		}
	});
	
}

$(".btn-primary").on("click",function(){
	if($("#ID_card").val() == null||$("#ID_card").val() == ""||$("#health_card").val() == null||$("#health_card").val() == ""||$("#c_pname").val() == null||$("#c_pname").val() == ""){
		alert("图片还没上传！");
	}
});

$("#c_mob").on("change", function(){
	 if($(this).val() != null){
	    $.ajax({
	    	type : "POST",
			url : "<%=path%>/backstage/shipperbymob",
			data : "c_mob=" + $(this).val(),
			success : function(msg) {
				//没有被注册
				msg = JSON.parse(msg);
				if(msg.resultid!="0"){
					istrue=0;
					var options="手机号已被注册";
					$("#span_mod").html(options);
				}else{
					istrue=1;
					var options="";
					$("#span_mod").html(options);
				}
			}
		});
	 }
});
</script>
</body>
</html>

